package com.jeeplus.modules.statistics.web;

import com.jeeplus.common.web.Result;
import com.jeeplus.modules.statistics.model.query.IndexStatisticsQuery;
import com.jeeplus.modules.statistics.model.vo.BusinessRanking;
import com.jeeplus.modules.statistics.model.vo.StatisticsXY;
import com.jeeplus.modules.statistics.model.vo.YearRankingVO;
import com.jeeplus.modules.statistics.service.IndexService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * ClassName: IndexController
 * Function:  统计分析首页 控制器
 * Date:      2021/2/24 9:52
 * @author     hanKongbin
 * version    V1.0
 */
@RestController
@AllArgsConstructor
@RequestMapping("/gx/statistics/index")
//@Api(tags = "高新统计分析-首页")
public class IndexController {
    private final IndexService indexService;

    //@ApiOperation("各区域当天接件排行榜")
    @PostMapping("/todayRanking")
    public Result<StatisticsXY> todayRanking(IndexStatisticsQuery query){
        return indexService.todayRanking(query);
    }

    //@ApiOperation("各区域月接件排行榜")
    @PostMapping("/monthRanking")
    public Result<StatisticsXY> monthRanking(IndexStatisticsQuery query){
        return indexService.monthRanking(query);
    }

    //@ApiOperation("各区域总接件排行榜（包含总接件数 otherData）")
    @PostMapping("/totalRanking")
    public Result<List<YearRankingVO>> totalRanking(IndexStatisticsQuery query){
        return indexService.yearRanking(query);
    }

    //@ApiOperation("各区域热度业务统计")
    @PostMapping("/businessRanking")
    public Result<List<BusinessRanking>> businessRanking(IndexStatisticsQuery query){
        return indexService.businessRanking(query);
    }

    //@ApiOperation("总接件数")
    @PostMapping("/total")
    public Result<Long> total(IndexStatisticsQuery query){
        return indexService.total(query);
    }
}
